<template>
	<view>
		<view>
			<!-- 底部播放器 -->
			<view class="player">
				<image class="player-cover" :src="song.songPhoto" />
				<view class="player-info" @click="goSongInfo">
					<view class="player-info-title">{{song.songName||"暂无歌曲播放"}}</view>
					<view class="player-info-singer">{{song.singerName}}</view>
				</view>
				<view class="player-controls">
					<!-- 切换到播放列表 -->
					<u-icon class="icon" name="list-dot" color="#2979ff" size="35" @tap="click"></u-icon>
					<!-- 播放或暂停 -->
					<u-icon name="pause-circle" v-if='isPlay' color="#2979ff" size="35"  @click="stop"></u-icon>
					<u-icon name="play-circle" v-else color="#2979ff" size="35" @click="begin"></u-icon>
				</view>
			</view>
		</view>
		<view class="he">  
		</view>
	</view>
	</view>
</template>

<script>
	import {mapState,mapMutations} from "vuex"
import store from "../../store/store";
	export default {
		name: "video",
		data() {
			return {
			};
		},
		computed:{
			...mapState('song', [
				'isPlay',
				'songId',
				'songUrl',
				'duration',
				'curTime',
				'changeTime',
				'songName',
				'singerName',
				'songPhoto',
				'autoNext',
				'songlist',
				'listIndex',
				'song'
			])
		},
		methods: {			
			...mapMutations('song', [
				'setIsPlay',
				'setSongId',
				'setSongUrl',
				'setDuration',
				'setCurTime',
				'setChangeTime',
				'setSongName',
				'setSingerName',
				'setsongPhoto',
				'setAutoNext',
				'setSongList',
				'setListIndex',
				'setSong'
			]),
			begin() {
				this.setIsPlay(true)
					uni.$inner.play()
			},
			//停止播放
			stop() {
				this.setIsPlay(false)
				uni.$inner.pause()
			},
			click(){
				console.log(this.songlist);
				uni.navigateTo({
					url:"/subpkg/listenList/listenList"
				})
			},
			play1(){
			},
			goSongInfo(){
				uni.navigateTo({
					url:'/pages/mus/mus'
				})
			}
		}
	}
</script>

<style lang="scss">
	/* 底部播放器 */

	.player {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #f0f0f0;
		// border-top: 1px solid #252525;
		box-shadow: 0 -1rpx 8rpx #888;
		height: 112rpx;
	}

	.player-cover {
		width: 80rpx;
		height: 80rpx;
		margin-left: 15rpx;
		border-radius: 8rpx;
		// border: 1px solid #333;
		box-shadow: 1rpx 1rpx 8rpx #888;
	}

	.player-info {
		flex: 1;
		font-size: 10pt;
		line-height: 38rpx;
		margin-left: 20rpx;
		padding-bottom: 8rpx;
		display: block;
		width: 200rpx;
	}

	.player-info-singer {
		color: #888;
	}

	.player-controls {
		margin-right: 15rpx;
		display: flex;
		justify-content: space-around;
	}

	.he {
		height: 50px;
	}
</style>
